package com.example.lab04.service.Impl;

import com.example.lab04.dao.GenericDao;
import com.example.lab04.entity.User;
import com.example.lab04.service.GenericService;
import org.springframework.beans.factory.annotation.Autowired;
import org.yaml.snakeyaml.events.Event;
import org.yaml.snakeyaml.tokens.Token;

import java.io.Serializable;
import java.util.List;

public abstract class GenericServiceImpl<T extends Serializable,ID extends Number> implements GenericService<T,ID> {
     GenericDao<T,ID> genericDao;

    public abstract void setGenericDao(GenericDao<T, ID> genericDao);


    @Override
    public List<T> queryAll() {
        return genericDao.queryAll();
    }

    @Override
    public T queryById(ID id) {
        return genericDao.queryById(id);
    }

    @Override
    public void create(T t) {
        genericDao.create(t);
    }

    @Override
    public void modify(T t) {
        genericDao.modify(t);
    }

    @Override
    public void removeById(ID id) {
        genericDao.removeById(id);
    }
    @Override
    public T queryOne(String sqlId, Object parameter) {
        return genericDao.queryOne(sqlId, parameter);
    }
}
